/*!
 * @file actionInit.cpp
 * @brief Ciało actionInit.hh
 */

#include "engine/cmd/actionInit.hh"
using namespace std;

/*--------------------------------------------------------------------------*/

bool actionInit::isPawirrInitialized = false;

/*--------------------------------------------------------------------------*/

actionInit::actionInit() :
	actionBase("init") {
}

/*--------------------------------------------------------------------------*/

void actionInit::doAction(std::string *array, int count, std::stringstream *ss) {

	if (count != 2) {
		return;
	}

	if (array[1] == "pawirr") {
		if (!actionInit::isPawirrInitialized) {
			pawirr::init();
		}

		actionInit::isPawirrInitialized = true;
	}
	else if(array[1] == "loop" && actionInit::isPawirrInitialized){
		pawirr::loop();
	}
}

/*--------------------------------------------------------------------------*/
